package com.example.modelDTO.converter;

import com.example.model.UserOwn;
import com.example.modelDTO.UserOwnDTO;

public class UserOwnConverter {
    public static UserOwnDTO toDto(UserOwn userOwn){
        UserOwnDTO dto=new UserOwnDTO();
        dto.setProductName(userOwn.getProductName());

        String imageStr=userOwn.getProductImage();
        imageStr=imageStr.substring(imageStr.lastIndexOf("/")+1);
        imageStr="../../images/gifts/"+imageStr+".png";
        dto.setProductImage(imageStr);
        dto.setObtainedTime(userOwn.getObtainedTime());
        dto.setValidityPeriod(userOwn.getValidityPeriod());
        dto.setExpirationDate(userOwn.getExpirationDate());
        return dto;
    }
}
